# Boyan infer base os
# Image is base os with pip packages

# Start FROM Ubuntu image https://hub.docker.com/_/ubuntu
FROM ubuntu:jammy

# Install linux packages
RUN sed -i 's/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list
RUN sed -i 's/security.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list
RUN apt update \
    && apt install --no-install-recommends -y python3-pip git zip unzip curl htop libgl1-mesa-glx libglib2.0-0 libpython3-dev gnupg g++ libturbojpeg vim
# RUN alias python=python3

# Remove python3.11/EXTERNALLY-MANAGED or use 'pip install --break-system-packages' avoid 'externally-managed-environment' Ubuntu nightly error
RUN rm -rf /usr/lib/python3.11/EXTERNALLY-MANAGED

# Install pip packages
RUN python3 -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
RUN python3 -m pip install --upgrade pip wheel
#RUN python3 -m pip install --no-cache -e . thop --extra-index-url https://download.pytorch.org/whl/cpu
RUN python3 -m pip install --no-cache opencv-python tritonclient[all] tqdm pyturbojpeg pika


# Usage Examples -------------------------------------------------------------------------------------------------------

# Build and Push
# t=docker-hub.hyacm.com/boyan/infer:latest && sudo docker build -f Dockerfile -t $t . && sudo docker push $t